package com.etc.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.etc.entity.Seller;
import com.etc.entity.User;
import com.etc.service.SellerService;
import com.etc.service.UserService;

@Controller
//@RequestMapping(value = "api")
public class UserController {

	@Resource
	private UserService us;


	/**
	 * 
	 * @return
	 */
	@RequestMapping(value = "/user", method = RequestMethod.GET)
	
	public ModelAndView showSellers() {
		ModelAndView mv = new ModelAndView("user-list_admin");
				List<User> list = us.showUsers();
				mv.addObject("user", list);
				return mv;
	}

	
	 /**
	    * 删除单个
	    * @param sellerId
	    * @return
	    */
	    @RequestMapping(value = "/delUser/{userId}", method = RequestMethod.DELETE)
		@ResponseBody
		public boolean delSeller(@PathVariable("userId") int userId) {

		
			boolean flag = us.delUer(userId);

			return flag;// 测试值
		}



	
	


}
